package com.bw.controller;
import com.bw.domain.User;
import com.bw.service.UserService;
import com.bw.utils.R;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * @author :Beyond🎸🎸
 * @date : 2025-03-03 18:10:04
 * @description Rock and Roll
 **/
@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    UserService userService;
    /**
    * @Author: Koma🤘🤘
    * @Description: 用户列表
    * @Param:
    * @return:
    * @Date: 2025/3/3 18:10
    */
    @RequestMapping("tolist")
    public String tolist(){
        return "user/list";
    }

    @RequestMapping("list")
    @ResponseBody
    public R list(User user,Integer page,Integer limit){
        PageHelper.startPage(page,limit);
        List<User> userList = userService.list(user);
        PageInfo<User> info = new PageInfo<>(userList);
        return R.OK(info);
    }
}
